<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh">
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
%>
<head>
    <meta charset="utf-8" />
    <title>保险代理后台管理系统</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
    <jsp:include page="../common/header.jsp"></jsp:include>
    <%@include file="../common/taglib.jsp"%>
    
    <!-- ================== 单独作用于本页表格td ================== -->
    <style>
        .input-group{
            width: 270px;
        }
    </style>
    <!-- ================== 单独作用于本页表格td ================== -->

</head>
<body>
<!-- begin #page-loader -->
<div id="page-loader" class="fade in"><span class="spinner"></span></div>
<!-- end #page-loader -->

<!-- begin #page-container -->
<div id="page-container" class="fade page-sidebar-fixed page-header-fixed">
    <jsp:include page="../common/top.jsp"/>

    <!-- begin #sidebar -->
    <jsp:include page="../common/sitebar.jsp"/>
    <div class="sidebar-bg"></div>
    <!-- end #sidebar -->
<!-- begin #content -->
<div id="content" class="content">
	<!-- begin page-header -->
	<!-- end page-header -->
	
	<!-- begin row -->
	<div class="row">
	    <!-- begin col-12 -->
	    <div class="col-md-12">
	        <!-- begin panel -->
            <ul class="nav nav-tabs">
                <li class="active"><a href="#default-tab-1" data-toggle="tab">日志列表</a></li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane fade active in" id="default-tab-1">
                        <form class="form-inline">
                            <div class="form-group m-r-20">
                                <label>&emsp;&nbsp;用户ip：</label>
                                <input type="text" class="form-control" id="remoteAddr" name="remoteAddr" placeholder="用户ip">
                            </div>
                            <div class="form-group">
                                <label>用户名：</label>
                                <input type="email" class="form-control" id="username" name="username" placeholder="用户名">
                            </div>
                            <div class="p-t-10">
                                <div class="form-group m-r-10">
                                    <label>操作时间：</label>
                                    <div class="input-group input-daterange">
                                        <input type="text" class="form-control datepicker-default" name="insureStartDate" id="insureStartDate" placeholder="开始日期" />
                                        <span class="input-group-addon">至</span>
                                        <input type="text" class="form-control datepicker-default" name="insureEndDate" id="insureEndDate" placeholder="结束日期"/>
                                    </div>
                                </div>
                                <button type="button" onclick="search()" class="btn btn-primary">查询</button>
                            </div>

                        </form>
                      <div class="table-responsive" >
                          <table id="modeltable" style="word-break:break-all;word-wrap:break-word" class="table table-striped table-bordered">
                              <thead>
                                  <tr>
                                      <th width="6%">编号</th>
                                      <th width="6%">用户名</th>
                                      <th width="6%">访问路径</th>
                                      <th width="6%">操作ip</th>
                                      <th width="6%">提交方式</th>
                                      <th width="6%">访问状态</th>
                                      <th width="6%">操作时间</th>
                                  </tr>
                              </thead>
                          </table>
                      </div>
                </div>
                </div>
            </div>      <!-- end panel -->
        </div>
              <!-- end col-12 -->
    </div>
          <!-- end row -->
</div>
<!-- end #content -->

<!-- end page container -->
<jsp:include page="../common/footer.jsp"/>
<script src="/static/js/order/order.js"></script>
<script>
    $(document).ready(function() {

        App.init();
        TableManageFixedHeader.init();
        wrapTable1();

        $('.selectpicker').selectpicker({
            style: 'btn-white',
            size: 5
        });
        //日期控件
        $(".datepicker-default").datepicker({
            autoclose: true, //自动关闭
            beforeShowDay: $.noop,    //在显示日期之前调用的函数
            calendarWeeks: false,     //是否显示今年是第几周
            clearBtn: false,          //显示清除按钮
            daysOfWeekDisabled: [],   //星期几不可选
            endDate: Infinity,        //日历结束日期
            forceParse: true,         //是否强制转换不符合格式的字符串
            format: 'yyyy-mm-dd',     //日期格式
            keyboardNavigation: true, //是否显示箭头导航
            language: "zh-CN",           //语言
            minViewMode: 0,
            orientation: "auto",      //方向
            rtl: false,
            startDate: -Infinity,     //日历开始日期
            startView: 0,             //开始显示
            todayBtn: false,          //今天按钮
            todayHighlight: true,    //今天高亮
            weekStart: 0
        });
    });


    //分页展示
    var table1;
    function wrapTable1() {
        table1 = $("#modeltable").DataTable({
            "bAutoWidth": false,
            /*"order": [[0, 'desc']],*/
            ordering:false,
            "pagingType": "simple_numbers",//设置分页控件的模式
            searching: false,//屏蔽datatales的查询框
            aLengthMenu: [15],//设置一页展示10条记录
            "bLengthChange": false,//屏蔽tables的一页展示多少条记录的下拉列表
            "oLanguage": {  //对表格国际化
                "sLengthMenu": "每页显示 _MENU_条",
                "sZeroRecords": "无匹配结果，请更换筛选条件再试",
                "sInfo": "当前第 _START_ - _END_ 条　共计 _TOTAL_ 条",
                "sInfoEmpty": "当前第 0 - 0 条　共计 0 条",
                "sInfoFiltered": "(从 _MAX_ 条记录中过滤)",
                "sSearch": "搜索：",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                }
            },
            "processing": true, //打开数据加载时的等待效果
            "serverSide": true,//打开后台分页
            "ajax": {
                "url": "/sysLog/getList/",
                "dataSrc": "aaData",
                "data": function (params) {
                    params.remoteAddr = $("#remoteAddr").val();
                    params.username = $("#username").val();
                    params.insureStartDate = $("#insureStartDate").val();
                    params.insureEndDate = $("#insureEndDate").val();
                }
            },
            "columns": [
                {
                    "data": "id",
                    "bSortable": false,
                    "defaultContent": '--'
                },
                {
                    "data": "username",
                    "bSortable": false,
                    "defaultContent": '--'
                },
                {
                    "data": "requestUrl",
                    "defaultContent": '--',
                    "bSortable": false
                },
                {
                    "data": "remoteAddr",
                    "defaultContent": '--',
                    "bSortable": false
                },
                {
                    "data": "method",
                    "defaultContent": '--',
                    "bSortable": false
                },
                {
                    "data": "status",
                    "defaultContent": '--',
                    "bSortable": false
                },
                {
                    "data": "accessTime",
                    "defaultContent": '--',
                    "bSortable": false
                }
            ],
        });

    }
    function search() {
        table1.ajax.reload();
    }
</script>
</body>
</html>
